<template>
  <div class="sortBox">
    <div>学科试题数量排名</div>
    <ul>
      <li v-for="(item, index) in list" :key="index">
        <span class="index">{{ index + 1 }}</span>
        <span class="center">{{ item.name }}</span>
        <span class="right">{{ item.num }}</span>
      </li>
    </ul>
  </div>
</template>
<script>
export default {
  data() {
    return {
      list: [
        { name: '前端', num: '5,234' },
        { name: 'java', num: '3,210' },
        { name: '大数据', num: '1,290' },
        { name: 'c++', num: '1,004' },
        { name: 'UI', num: '934' },
        { name: 'php', num: '856' },
        { name: 'python', num: '498' },
        { name: '测试', num: '123' }
      ]
    }
  },
  methods: {}
}
</script>
<style scoped lang="scss">
* {
  margin: 0;
}
.sortBox {
  position: absolute;
  top: 20px;
  left: 820px;
  font-size: 18px;
  ul {
    margin-top: 20px;
    color: #666;
    list-style: none;
    li {
      margin-top: 10px;

      .index {
        display: inline-block;
        width: 20px;
        height: 20px;
        margin-left: -40px;
        text-align: center;
        border-radius: 50%;
      }
      .center {
        margin-left: 30px;
      }
      .right {
        position: absolute;
        left: 280px;
        // margin-left: 60px;
      }
    }
    li:nth-child(-n + 3) {
      span:nth-child(1) {
        background-color: #314659;
        color: #fff;
      }
    }
    li:nth-child(n + 4) {
      span:nth-child(1) {
        background-color: #f5f5f5;
        color: #314659;
        font-size: 16px;
      }
    }
  }
  .sort {
  }
}
</style>
